/*
 * Licensed to The Apereo Foundation under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 *
 * The Apereo Foundation licenses this file to you under the Educational
 * Community License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License
 * at:
 *
 *   http://opensource.org/licenses/ecl2.txt
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 */


// Main Header
// ----------------------------------------

.primary-header {
    $height: 50px;
    width: 100%;
    height: $height;
    box-shadow: 0 1px 3px 1px rgba($black, 0.3);
    position: relative;
    border-bottom: 1px solid #1d3041;
    @include linear-gradient(top, #388ed6, #2075b1);

    .header-branding {
        float: left;

        a.logo {
            display: block;
            padding: 14px 20px 13px;

            img {
                width: $logo-width;
                height: $logo-height;
            }
        }
    }
}


// Navigation Dropdown Container
// ----------------------------------------

.header-nav {
    float: right;
    margin-right: $side-margin;
    margin-top: 13px;

    // Nav items
    .nav-dd {
        color: #fff;
        display: inline-block;
        vertical-align: middle;
        font-size: 12px;
        position: relative;
        margin-left: 15px;
        cursor: pointer;

        &.active .dropdown-ul {
            opacity: 1;
            visibility: visible;
        }
    }

    // Index rebuild indicator
    .nav-rb-warning {
        color: red;
        font-weight: bold;
        padding: 0 7px;
    }

    .nav-rb-header {
        font-weight: bold;
    }

    .dropdown-ul {
        position: absolute;
        z-index: $max-z + 10;
        opacity: 0;
        visibility: hidden;
        @extend %menu-dropdown-base;

        a {
            font-weight: 600;
        }
    }
}


.nav-dd-container {

    $header-dropdown-top-position: 37px;

    // User Dropdown
    // ----------------------------------------

    .user-dd .dropdown-ul {
        width: 150px;
        top: 31px;
        right: -11px;
    }

    .nav-dd .dropdown-ul {
        width: 150px;
        top: 31px;
        right: -11px;
    }

    // Menu Icon Settings
    $icon-color: $medium-prim-color;
    $icon-font-size: 15px;
    $icon-display-value: inline-block;
    $icon-pesudo-position: before;

    .cogs-icon {
        @include fa-icon($fa-var-cogs, $icon-pesudo-position, $icon-display-value, 0 10px 0 0, 0, $icon-color, $icon-font-size);
    }

    .logout-icon {
        @include fa-icon($fa-var-power-off, $icon-pesudo-position, $icon-display-value, 0 14px 0 0, 0, $icon-color, $icon-font-size);
    }

    .fa {
        color: #fff;
        font-size: 20px;
    }

    // Rebuild Dropdown
    // ----------------------------------------

    .rebuild-dd .dropdown-ul {
        width: 240px;
        top: $header-dropdown-top-position;
        right: 5px;
    }

    // Language Dropdown
    // ----------------------------------------

    .lang-dd .dropdown-ul {
        width: 160px;
        top: $header-dropdown-top-position;
        right: 5px;
    }

    // Language Flags
    @mixin flag-style($size) {
        height: $size;
        vertical-align: middle;
        border-radius: 1px;
        border: 1px solid gray;
    }

    .lang {
        display: inline-block;
        vertical-align: middle;
        margin-right: 10px;
        img {
            @include flag-style(18px);
        }
    }

    .lang-flag {
        @include flag-style(16px);
        margin-right: 5px;
    }

    // RestService Dropdown
    // ----------------------------------------
    .info-dd{
        max-height: 20px;
        max-width: 20px;
        .dropdown-ul{
            width: auto;
            top: 31px;
            right: -7px;
        }
        .fa-bell-o{
            float: right;
        }
        #error-count{
            display: inline-block;
            min-width: 10px;
            padding: 4px 7px;
            font-size: 10px;
            font-weight: 700;
            line-height: 1;
            color: #fff;
            text-align: center;
            white-space: nowrap;
            vertical-align: middle;
            border-radius: 100%;
            background-color: red;
            position: relative;
            bottom: 25px;
            left: 10px;
        }
    }
}

// Dropdown Icon
// ----------------------------------------

.dropdown-icon {
    @include fa-icon($fa-var-chevron-down, after, inline-block, 0 0 0 5px);
}


// Action Navigation Bar
// ----------------------------------------

.action-nav-bar {
    $height: 80px;
    width: 100%;
    height: $height;
    position: relative;
    background: $d-blue;

    .btn-group {
         float: right;
         margin-right: $side-margin;
         margin-top: 18px;

        // btn specific styles
        .add {
            @include btn(green-dark-bg);

            &.plus-icon {
                @include fa-icon($fa-var-plus, before, inline-block, 0 10px 0 0);
            }

            &.user-icon {
                @include fa-icon($fa-var-user, before, inline-block, 0 10px 0 0);
            }

            &.group-icon {
                @include fa-icon($fa-var-users, before, inline-block, 0 10px 0 0);
            }
        }

        .secondary {
             @include btn(blue-dark-bg);
             margin-right: 20px;

             &:first-child {
                margin-right: 0;
             }
        }

        .export {

            // Overide DD container
            line-height: 0;
            padding: 0;
            text-shadow: none;
            color: #fff;

            // Overide size
            width: 115px;
            height: 39px;

            > i {
                vertical-align: middle;

                &:first-child {
                    @include build-icon(auto, auto, export, 19px, 16px);
                }

                &.fa-chevron-down {
                    margin-right: 0;
                    font-size: 10px;
                    position: static;
                }
            }
        }

        .upload > i {
            vertical-align: middle;
            @include build-icon(auto, auto, upload, 19px, 16px);
        }
    }

    // Menu top
    .menu-top {
        width: 80px;
        height: 42px;
        background: #243e55;
        @include border-top-radius(4px);
        border: $thin-border-stroke darken(#1e364b, 3%);
        border-bottom: none;
        cursor: pointer;
        position: absolute;
        top: 36px;
        left: $side-margin;

        @include fa-icon($fa-var-bars, 'before', inline-block, 10px 0 0 30px, 0, #3F5E78, 22px);
        @include fa-icon($fa-var-bars, 'hover:before', inline-block, 10px 0 0 30px, 0, #5B7B96, 22px);
    }

    // Subpage Navigation
    nav {
        position: absolute;
        top: 50px;
        left: 120px;

        a {
            display: inline-block;
            color: $header-link-color;
            text-align: center;
            position: relative;
            padding: 0 20px;

            &:hover {
                color: lighten($header-link-color, 10%);
            }

            &.active {
                font-weight: 600;
                color: $off-white;

                @include triangle-point(bottom, 7px, 7px, 50%, $off-white, 0, transparent, 9px);
                &:before,
                &:after {
                    margin-right: -7px;
                }
            }
        }
    }
}



// Page Navigation Bar
// ----------------------------------------

// Markup Example: https://gist.github.com/mattmischuk/5dc55fd276efe3ae6949

.page-nav-bar {

    $dark-blue: #24425d;
    $mid-blue: #2b77b9;

    margin-bottom: 20px;

    nav {

        // Grey and Default
        // ------------------------------

        &.grey a,
        a {
            @include btn(white);
            border: 1px solid $main-border-color;

            &:not(:last-child) {
                border-right: 1px solid $main-border-color;
            }
        }


        // Dark Blue
        // ------------------------------

        &.dark-blue a {
            @include btn(blue);
            border: $thin-border-stroke darken($dark-blue, 5%);
            display: inline-block;
            padding: 12px 15px;
            text-shadow: 0 1px 1px rgba($black, 0.15);
            border-radius: 0;

            &.active {
                border: darken($mid-blue, 50%);

                &:not(:first-child) {
                    border-left: 1px solid $dark-blue;
                }
            }

            &:not(:last-child) {
                border-right: 1px solid $dark-blue;
            }
        }


        // Global
        // ------------------------------

        a,
        .grey a,
        .dark-blue a {
            display: inline-block;
            font-size: 13px;
            border-radius: 0;
            padding: 12px 15px;
            margin: 0;

            &:not(:first-child) {
                margin-left: -5px;
            }

            &:first-child {
                border-top-left-radius: $main-border-radius;
                border-bottom-left-radius: $main-border-radius;
            }

            &:last-child {
                border-top-right-radius: $main-border-radius;
                border-bottom-right-radius: $main-border-radius;
            }

            // Active Page
            // ----------------------------------------

            &.active {
                color: #fff !important;
                text-shadow: 0 1px 0 rgba($black, 0.2);
                border: 1px solid $l-blue;

                @include linear-gradient(top, lighten($mid-blue, 20%), lighten($mid-blue, 10%));
                box-shadow: inset 0 1px 0 0 rgba($white, 0.2), 0 2px 3px 1px rgba($black, 0.05);

                &:hover {
                    @include linear-gradient(top, lighten($mid-blue, 20%), lighten($mid-blue, 10%));
                }

                &:active {
                    box-shadow: none;
                }
            }
        }
    }
}


// Page Navigation Bar Layout Options
// ----------------------------------------

// Floats Bar to Right when within ".action-nav-bar" container

.action-nav-bar .page-nav-bar {
    display: inline-block;
    float: right;
    margin-top: 20px;
    margin-right: 20px;
}


// Page nav container is used when you are creating a new row that includes the page title
// Example: https://gist.github.com/mattmischuk/b4dcb1e245f00b21c6a6

.page-nav-container {
    @include clearfix();
    width: 100%;

    .page-nav-bar {
        margin: 20px auto 0;
        width: 100%;
        text-align: center;

        a {
            box-shadow: none;
        }

        &.span-5 a {
            width: 20%;
            padding: 12px 0;

            &:nth-child(even) {
                margin-left: -6px;
            }

            &:nth-child(odd) {
                margin-left: -7px;
            }

            &:first-child {
                margin-left: 0;
            }
        }
    }

    .active {
        position: relative;
        z-index: 10;
    }
}
